home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM 3
/
Light ROM 3 - Disc 2.iso
/
programs
/
amiga
/
macromkr
/
rexxscri.lha
/
REXXscripts
/
ZoomIn.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1993-07-27
|
4KB
|
108 lines
/* ZoomIn.rexx */
/* --------------- */
/* July 27th, 1993 */
/*
* Takes the primary buffer and generates "frames" number of zoomed
* output frames of the same, or user specifed resolution. Can
* zoom to the center of the image or a user-specified pixel location,
* or, it can PAN along a linear path while zooming (we were going to
* make it pan along a spline, but we'll leave that "as an exercise
* for the student" the way the textbooks do when something's too hard
* for them to do themselves. :^) Does not produce an output frame that
* is at -0- zoom; you already have that, so why waste the time?
* You must have memory available to hold the zoomed frame, it
* (teporarily) exists as a second buffer inside Imagemaster or
* Imagemaster R/t.
*
* The more frames you specify, the smoother the zoom will be.
*/
/*
* 1 - Modify the "Set These" parameters below to suit your fancy
* 2 - Place this script in the RXPI: assignment
* 3 - Start Imagemaster
* 4 - Load the image you want to zoom as primary
* 5 - Go to a shell and type "RX RXPI:ZOOMIN"
* 6 - Zoomed frames are generated to path:file.framenumber in 24bit IFF
* 7 - Do what you want with the output
*/
/* Set these as you prefer */
/* ----------------------- */
frames = 5; /* total zooms to produce (not counting unzoomed) */
maxzoom = 1000; /* maximum zoom to reach in last frame */
o_flag = 'NOMATCH'; /* MATCH or NOMATCH */
o_x = 160; /* to set custom output size, change o_flag from MATCH to NOMATCH */
o_y = 120; /* otherwise will match input image size exactly */
c_flag = 'PAN'; /* CENTER, CUSTOM, or PAN */
c_xs = 10; /* for a "hard" center, change c_flag to CUSTOM, set c_xs, c_ys */
c_ys = 10; /* for a zoom around the center, change c_flag to CENTER */
c_xe = 630; /* If you want the zoom to pan, change the c_flag to PAN and... */
c_ye = 470; /* ...set c_xs, c_ys, c_xe and c_ye variables start and end. */
fpath = 'ram:';
fname = 'zoom_frame';
/* ------------------------------------ */
/* !!! leave stuff below here alone !!! */
/* ------------------------------------ */
if frames = 0 then do
say "Sorry! You can't zoom ZERO frames!";
exit 0;
end;
zoomfraction = maxzoom / frames;
address 'IM_Port';
'imagepath "'||fpath'"';
do i=1 to frames
say 'Generating Frame #'||i;
options results; /* Tell IM that we want answers to our functions */
'current'; /* ask about current buffer */
bufinfo = result;
parse var bufinfo bname ',' bnum ',' xd ',' yd ',' size ',' mem ',' pname ',' pnum;
if o_flag = 'match' then do /* matched output size */
xs = xd; ys = yd;
end;
else do /* specified output size */
xs = o_x; ys = o_y;
end;
if c_flag = 'CENTER' then do
xc = xd/2; yc = yd/2; /* zoom to center */
end;
else do
xc = c_xs; /* assumes c_flag = CUSTOM */
yc = c_ys;
if c_flag = 'PAN' then do
if c_xs > c_xe then do
xc = c_xs - (((c_xs - c_xe) / frames) * i);
end;
else do
xc = c_xs + (((c_xe - c_xs) / frames) * i);
end;
if c_ys > c_ye then do
yc = c_xs - ((c_ys - c_ye) / frames) * i);
end;
else do
yc = c_ys + (((c_ye - c_ys) / frames) * i);
end;
end;
else do
end;
end;
zoomfactor = zoomfraction * i;
parse var zoomfactor zoomfactor '.' junk; /* int(x) */
parse var xc xc '.' junk; /* int(x) */
parse var yc yc '.' junk; /* int(x) */
zbname = fname||'.'||i;
'zoomclip' zoomfactor zoomfactor xc yc zbname xs ys;
newbuf = result; /* buffer number of new clip */
options; /* no more results */
'save' newbuf; /* save the zoom frame */
'killbuff' newbuf; /* get rid of output frame */
say ' ....frame "'||fpath||fname||'.'||i||'" written!';
end;
'finish'; /* inform IM we're done */